import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login.vue')
};

export const page404 = {
    path: '/*',
    name: 'error_404',
    meta: {
        title: '404-页面不存在'
    },
    component: () => import('@/views/error_page/404.vue')
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error_403',
    component: () => import('@//views/error_page/403.vue')
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error_500',
    component: () => import('@/views/error_page/500.vue')
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: () => import('@/views/main_components/lock_screen/components/locking-page.vue')
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        {
            path: 'home',
            title: {i18n: 'home'},
            name: 'home_index',
            component: () => import('@/views/home/home.vue')
        },
        {
            path: 'own',
            title: '个人中心',
            name: 'own_index',
            component: () => import('@/views/own/index.vue')
        },
        {
            path: 'request/:hash',
            title: '请求参数',
            name: 'interface_request',
            component: () => import('@/views/interface/request.vue')
        },
        {
            path: 'response/:hash',
            title: '返回参数',
            name: 'interface_response',
            component: () => import('@/views/interface/response.vue')
        },
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/system',
        icon: 'wrench',
        name: 'system',
        title: '系统配置',
        component: Main,
        children: [
            {
                path: 'menu',
                icon: 'navicon-round',
                name: 'menu',
                access: 'admin/system/menu',
                title: '菜单维护',
                component: () => import('@/views/system/menu.vue')

            },
            {
                path: 'admins',
                icon: 'ios-people',
                name: 'admins',
                access: 'admin/system/user',
                title: '用户管理',
                component: () => import('@/views/system/user.vue')
            },
            
            {
                path: 'auth',
                icon: 'locked',
                name: 'auth',
                access: 'admin/system/auth',
                title: '用户组管理',
                component: () => import('@/views/system/auth.vue')
            },
            {
                path:  'rule',
                icon:  'ios-settings',
                name:  'rule',
                access:  'admin/system/rule',
                title:  '权限规则管理',
                component:()=>import('@/views/system/rule.vue')
            },
            {
                path:  'performance',
                icon:  'ios-settings',
                name:  'performance',
                access:  'admin/system/performance',
                title:  '管理员业绩',
                component:()=>import('@/views/system/performance.vue')
            },
            // {
            //     path: 'log',
            //     icon: 'clipboard',
            //     name: 'log',
            //     access: 'admin/Log/index',
            //     title: '操作日志',
            //     component: () => import('@/views/system/log.vue')
            // }
        ]
    },
    {
        path: '/house',
        icon: 'wrench',
        name: 'house',
        title: '房屋管理',
        component: Main,
        children: [
            {
                path: 'main',
                icon: 'navicon-round',
                name: 'main',
                access: 'admin/house/main',
                title: '房源列表',
                component: () => import('@/views/house/main.vue')

            },
            {
                path: 'add',
                icon: 'navicon-round',
                name: 'add',
                access: 'admin/house/main',
                title: '添加房源',
                component: () => import('@/views/house/add.vue')
            },
            {
                path: 'post',
                icon: 'ios-people',
                name: 'post',
                access: 'admin/house/post',
                title: '发布房源类型',
                component: () => import('@/views/house/post.vue')
            },
        ]
    },
    {
        path:"/user",
        icon:"social-github-outline",
        name:"user",
        title:'客户管理',
        component:Main,
        children:[
            {
                path:"users",
                icon: "ios-box",
                name: 'users',
                access: 'admin/user/users',
                // access: 'admin/User/index',
                title: '客户列表',
                component:()=>import('@/views/user/main.vue')
            },
            {
                path:"rent",
                icon: "android-cloud",
                name: 'rent',
                access: 'admin/user/rent',
                // access: 'admin/User/index',
                title: '租房管理',
                component:()=>import('@/views/user/rent.vue')
            },
            {
                path:"demand",
                icon: "android-cloud",
                name: 'demand',
                access: 'admin/user/demand',
                // access: 'admin/User/index',
                title: '租房需求',
                component:()=>import('@/views/user/demand.vue')
            }
        ]
    },
    {
        path:"/finance",
        icon:"social-usd-outline",
        name:"finance",
        title:'财务管理',
        component:Main,
        children:[
            {
                path:"recharge",
                icon: "arrow-graph-up-right",
                name: 'recharge',
                access: 'admin/finance/rechrge',
                // access: 'admin/User/index',
                title: '充值记录',
                component:()=>import('@/views/finance/recharge.vue')
            },
            {
                path:"withdraw",
                icon: "arrow-graph-up-right",
                name: 'withdraw',
                access: 'admin/finance/withdraw',
                // access: 'admin/User/index',
                title: '提现记录',
                component:()=>import('@/views/finance/withdraw.vue')
            },
            {
                path:"charge",
                icon: "arrow-graph-up-right",
                name: 'charge',
                access: 'admin/finance/charge',
                // access: 'admin/User/index',
                title: '扣款记录',
                component:()=>import('@/views/finance/charge.vue')
            },
        ]
    },
    {
        path:"/slideshow",
        icon:"social-usd-outline",
        name:"slideshow",
        title:'小程序',
        component:Main,
        children:[
            {
                path:"picture",
                icon: "arrow-graph-down-right",
                name: 'picture',
                access: 'admin/slideshow/picture',
                // access: 'admin/User/index',
                title: '轮播图',
                component:()=>import('@/views/slideshow/picture.vue')
            },
            {
                path:"coupon",
                icon: "arrow-graph-down-right",
                name: 'coupon',
                access: 'admin/slideshow/coupon',
                // access: 'admin/User/index',
                title: '优惠券',
                component:()=>import('@/views/slideshow/coupon.vue')
            },
            {
                path:"hot",
                icon: "arrow-graph-down-right",
                name:'hot',
                access: 'admin/slideshow/hot',
                title: '热门城市',
                component:()=>import('@/views/slideshow/hot.vue')
            },
            {
                path:"account",
                icon:"arrow-graph-down-right",
                name:"account",
                access:'admin/slideshow/account',
                title:'对公账号',
                component:()=>import('@/views/slideshow/account.vue')
            },
            {
                path:"article",
                icon:"arrow-graph-down-right",
                name:"article",
                access:"admin/slideshow/article",
                title:"烦租圈",
                component:()=>import('@/views/slideshow/article.vue')
            }
        ]
    }
    // {
    //     path: "/app",
    //     icon: "android-cloud",
    //     name: "app",
    //     title: "应用接入",
    //     component: Main,
    //     children: [
    //         {
    //             path: "group",
    //             icon: "ios-box",
    //             name: "app_group",
    //             access: 'admin/AppGroup/index',
    //             title: "应用分组",
    //             component: () => import('@/views/app/group.vue')
    //         },
    //         {
    //             path: "index",
    //             icon: "ios-list",
    //             name: "app_index",
    //             access: 'admin/App/index',
    //             title: "应用列表",
    //             component: () => import('@/views/app/list.vue')
    //         }
    //     ]
    // },
    // {
    //     path: "/interface",
    //     icon: "navigate",
    //     name: "interface",
    //     title: "接口管理",
    //     component: Main,
    //     children: [
    //         {
    //             path: "group",
    //             icon: "folder",
    //             name: "interface_group",
    //             access: 'admin/InterfaceGroup/index',
    //             title: "接口分组",
    //             component: () => import('@/views/interface/group.vue')
    //         },
    //         {
    //             path: "list",
    //             icon: "document",
    //             name: "interface_list",
    //             access: 'admin/InterfaceList/index',
    //             title: "接口列表",
    //             component: () => import('@/views/interface/list.vue')
    //         }
    //     ]
    // },
    // {
    //     path: '/international',
    //     icon: 'earth',
    //     title: {i18n: 'international'},
    //     name: 'international',
    //     component: Main,
    //     children: [
    //         {
    //             path: 'index',
    //             title: {i18n: 'international'},
    //             name: 'international_index',
    //             component: () => import('@/views/international/international.vue')
    //         }
    //     ]
    // }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
